/**
 * 
 */
package org.i1510.base.utils.ParadoxJdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * @author Administrator
 *
 */
public class Test {

	/**
	 *@Author Rambo
	 *@Desc：delphi paradox数据库操作
	 *@param args TODO
	 * @throws ClassNotFoundException 
	 * @throws SQLException 
	 *@Version  Test.java,v 1.1 2014-12-24 下午2:14:33 
	 */
	public static void main(String[] args) throws ClassNotFoundException, SQLException {
		 
		String driver = "com.hxtt.sql.paradox.ParadoxDriver";

		String url = "jdbc:paradox:/D:\\paradox_db";

		Class.forName(driver);

		Connection conn = DriverManager.getConnection(url,"",""); 
		Statement stmt = conn.createStatement(); // 建表时的插入语句记得为' ',而不是" "
		String strSql = "SELECT * FROM XSJL";// 将sql中将;去掉
		ResultSet rs = stmt.executeQuery(strSql);
		while (rs.next()) {
			// System.out.println("TestID:"+rs.getString(1));
			System.out.println(rs.getObject(1) + "\t" + rs.getObject(2)+ "\t" + rs.getObject(3)+ "\t" + rs.getObject(4)+ "\t" + rs.getObject(5)+ "\t" + rs.getObject(6));
			// System.out.println("Describe:"+rs.getString(2));
		}
		
		
//		String sql = "create table IF NOT EXISTS kb_html_all(id varchar(36),name varchar(10));";
//		Statement stmt = null;
//		int count = 0;
//		try {
//
//			stmt = conn.createStatement();
//			count = stmt.executeUpdate(sql);
//		} catch (Exception ex) {
//			ex.printStackTrace();
//			count = 0;
//		} finally {
//			if (stmt != null) {
//				try {
//					stmt.close();
//				} catch (Exception ex) {
//					ex.printStackTrace();
//				}
//			}
//			if (conn != null) {
//				try {
//					conn.close();
//				} catch (Exception ex) {
//					ex.printStackTrace();
//				}
//			}
//		}
//	System.out.println(count);


	}

}
